package com.zmn.plat.common.dictionary;

/**
 * 渠道接入方式枚举
 *
 * @author linfeng
 * @since 2019 /10/31 14:56:30
 */
public enum ChannelCompanyBankEnum {

    /**
     * values
     */
    YES(ChannelCompanyBankEnum.COMPANY_BANK_TWO, "是"),
    NO(ChannelCompanyBankEnum.COMPANY_BANK, "否");

    /**
     * 话务接入
     */
    public static final int COMPANY_BANK = 1;
    /**
     * H5
     */
    public static final int COMPANY_BANK_TWO = 2;

    private Integer code;
    private String name;

    ChannelCompanyBankEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelCompanyBankEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        switch (code) {
            case 1:
                return NO;
            case 2:
                return YES;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelCompanyBankEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
